import request from '@/utils/request'

export const flightRouteService = {
  // 获取航线列表
  getRoutes(params) {
    return request({
      url: '/routes',
      method: 'get',
      params
    }).then(response => response.data)
  },
  
  // 获取航线详情
  getRouteDetail(id) {
    return request({
      url: `/routes/${id}`,
      method: 'get'
    }).then(response => response.data)
  },
  
  // 创建航线
  createRoute(data) {
    return request({
      url: '/routes',
      method: 'post',
      data
    }).then(response => response.data)
  },
  
  // 更新航线
  updateRoute(id, data) {
    return request({
      url: `/routes/${id}`,
      method: 'put',
      data
    }).then(response => response.data)
  },
  
  // 删除航线
  deleteRoute(id) {
    return request({
      url: `/routes/${id}`,
      method: 'delete'
    }).then(response => response.data)
  },
  
  // 获取航线点列表
  getRoutePoints(routeId) {
    return request({
      url: `/routes/${routeId}/points`,
      method: 'get'
    }).then(response => response.data)
  },
  
  // 更新航线点
  updateRoutePoints(routeId, data) {
    return request({
      url: `/routes/${routeId}/points`,
      method: 'put',
      data
    })
  }
}